<?php
class EmailGroupModel extends Model {
		public function __construct(){
			$this->open(Model::MYSQL);
			$this->calledClass(get_class($this));
		}
		public function findArray($where=array()){
			$this->open(Model::MYSQL);
			return parent::findAsArray($where);
		}
		public function getObject($fields=array(),$where=array()) {
			$this->open(Model::MYSQL);
			return parent::getAsObject($fields,$where);
		}
		public function getArray($fields=array()){
			$this->open(Model::MYSQL);
			return parent::getAsArray($fields);
		}
		public function findObject($where=array()){
			$this->open(Model::MYSQL);
			return parent::findAsObject($where);
		}
		public function getList($page=1,$perpage=20,$search="",$searchFields=array(),$sortFields=array(),$sortCriteria=""){
			$this->open(Model::MYSQL);
			return parent::getList($page,$perpage,$search,$searchFields,$sortFields,$sortCriteria);
		}
		public function delete($where=array(),$deleteSet=false){
			$this->open(Model::MYSQL);
			return parent::delete($where,$deleteSet);
		}
		public function numRows($result){
			$this->open(Model::MYSQL);
			return is_resource($result)?mysql_num_rows($result):null;
		}
		public function query( $query ){
			$this->open(Model::MYSQL);
			return parent::query( $query );
		}
		public function save($fields=array()){
			$this->open(Model::MYSQL);
			return parent::save($fields);
		}
		public function update($fields=array(),$where=array()){
			$this->open(Model::MYSQL);
			return parent::update($fields,$where);
		}
		public function getCandidateEmail(){
			$this->open(Model::MYSQL);
			$query = "SELECT email FROM EmailGroups WHERE groups='can'";
			$result = parent::query($query);
			$candidate = array();
			while($rows = mysql_fetch_object($result)){
				$candidate[] = $rows;
			}
			return $candidate;
		}
		public function getEmployerEmail(){
			$this->open(Model::MYSQL);
			$query = "SELECT email FROM EmailGroups WHERE groups='emp'";
			$result = parent::query($query);
			$employer = array();
			while($rows = mysql_fetch_object($result)){
				$employer[] = $rows;
			}
			return $employer;
		}
		public function getEmaiGroupMemberName(){
			$this->open(Model::MYSQL);
			$query = "SELECT * FROM EmailGroups";
			$result = parent::query($query);
			$employer = array();
			while($rows = mysql_fetch_object($result)){
				$employer[] = $rows;
			}
			return $employer;
		}
		public function getEmail($g){
			$this->open(Model::MYSQL);
			$query = "SELECT email FROM EmailGroups WHERE groups='".$g."'";
			$result = parent::query($query);
			$email = array();
			while($rows = mysql_fetch_object($result)){
				$email[] = $rows;
			}
			return $email;
		}
		
		
		
		
		
		
		
		
		
}